package com.yxh.sse.action;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;



public class UploadAction {
	
	private String tx;
	
	private String upload;
	
	private String uploadContentType;
	
	private String uploadFileName;
	
	public String execute(){
		try {
			FileOutputStream fos=new FileOutputStream("d:\\woainiyxh\\"+getUploadFileName());
		    FileInputStream fis=new FileInputStream(getUpload());
		    byte[] buffer =new byte[1024];
		    int len=0;
		    try {
				while((len=fis.read(buffer))>0){
					try {
						fos.write(buffer,0,len);
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	public String getUploadContentType() {
		return uploadContentType;
	}

	public void setUploadContentType(String uploadContentType) {
		this.uploadContentType = uploadContentType;
	}

	public String getUploadFileName() {
		return uploadFileName;
	}

	public void setUploadFileName(String uploadFileName) {
		this.uploadFileName = uploadFileName;
	}

	public String getTx() {
		return tx;
	}

	public void setTx(String tx) {
		this.tx = tx;
	}

	public String getUpload() {
		return upload;
	}

	public void setUpload(String upload) {
		this.upload = upload;
	}

}
